Skip to content

drivers: media: i2c Updated imx296 driver for external trigger - #5560

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.1.yfrom
bebon901:rpi-6.1.y
Aug 1, 2023
Merged

pelwell merged 1 commit into
raspberrypi:rpi-6.1.yfrom
bebon901:rpi-6.1.y

Conversation

@bebon901

@bebon901 bebon901 commented Aug 1, 2023

Copy link
Copy Markdown

Updated imx296 driver to support external trigger mode via XTR pin. Added module parameter to control this mode.

Updated imx296 driver to support external trigger mode via XTR pin.
Added module parameter to control this mode.

Signed-off-by: Ben Benson <ben.benson@raspberrypi.com>
@naushir

naushir commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

LGTM.

@pelwell

pelwell commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Checkpatch is complaining that you've not followed the kernel coding style w.r.t. brace placement. Other than that it looks good.

@pelwell
pelwell merged commit e1b03ea into raspberrypi:rpi-6.1.y Aug 1, 2023
@pelwell

pelwell commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Thanks!

@6by9

6by9 commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

I know this has been merged, but a minor comment that PM_RUNTIME is optional and is also using autosuspend. That means there is no guarantee that the sensor will be reset before each stream_on, and a module parameter can be changed dynamically. Once set into XTRIG mode there is no way to come back out of it unless PM_RUNTIME performs a shutdown on the sensor via the regulator framework.

The datasheet also implies that this isn't just a simple external trigger for changing frame rate. For fast trigger mode it states:
Exposure time = (XTRIG low level pulse width) + 14.26us
That totally changes the way the sensor would function, so I'm curious whether this works as intended when running with libcamera.

@naushir

naushir commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

I know this has been merged, but a minor comment that PM_RUNTIME is optional and is also using autosuspend. That means there is no guarantee that the sensor will be reset before each stream_on, and a module parameter can be changed dynamically. Once set into XTRIG mode there is no way to come back out of it unless PM_RUNTIME performs a shutdown on the sensor via the regulator framework.

True. We can fix this on top, but I'm not too concerned right now as I doubt users will be switching into and out of this mode at runtime just yet.

The datasheet also implies that this isn't just a simple external trigger for changing frame rate. For fast trigger mode it states: Exposure time = (XTRIG low level pulse width) + 14.26us That totally changes the way the sensor would function, so I'm curious whether this works as intended when running with libcamera.

Yes it does work as expected. The pulse width sets the exposure time, and we fix the shutter speed in libcamera and the AGC will auto adjust gain as it needs. All very cool!

@6by9

6by9 commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Ah, I hadn't noted the Signed-of-by, so had assumed this was a 3rd party contribution.

Yes it does work as expected. The pulse width sets the exposure time, and we fix the shutter speed in libcamera and the AGC will auto adjust gain as it needs. All very cool!

That isn't how I expect it to work. You still have an active V4L2_CID_EXPOSURE control when in this mode, so I'd expect that to determine the exposure time, not some external trigger.

It is permitted to have a module parameter that is only checked at probe, so you could remove that control or make it read only at a nominal value if the module parameter is in external trigger mode.

I wonder if there a master mode where an IMX296 will generate a suitable trigger based on the configured exposure? I don't see anything obvious in the datasheet.

@naushir

naushir commented Aug 1, 2023

Copy link
Copy Markdown
Contributor

Removing the control is a no-go as libcamera expects V4L2_CID_EXPOSURE to be available. We can make it read-only with a nominal (but really meaningless) value.

I wonder if there a master mode where an IMX296 will generate a suitable trigger based on the configured exposure? I don't see anything obvious in the datasheet.

There is a "stereo mode" operation that sort of does this, but it's not exactly what this trigger mode does, and does not seem to be fully deterministic in behavior.

popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Aug 7, 2023
kernel: drivers: media: i2c Updated imx296 driver for external trigger
See: raspberrypi/linux#5560

kernel: overlays: Add bmp380 to i2c-sensor overlay
See: raspberrypi/linux#5558

kernel: drivers: media: imx296: Add standby delay during probe
See: raspberrypi/linux#5555

kernel: can: isotp: add module parameter for maximum pdu size
See: raspberrypi/linux#5557

kernel: media: dt-bindings: imx258: Fix alternate compatible strings
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Aug 9, 2023
kernel: drivers: media: i2c Updated imx296 driver for external trigger
See: raspberrypi/linux#5560

kernel: overlays: Add bmp380 to i2c-sensor overlay
See: raspberrypi/linux#5558

kernel: drivers: media: imx296: Add standby delay during probe
See: raspberrypi/linux#5555

kernel: can: isotp: add module parameter for maximum pdu size
See: raspberrypi/linux#5557

kernel: media: dt-bindings: imx258: Fix alternate compatible strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants